home *** CD-ROM | disk | FTP | other *** search
- global oIndexMediator, gNumofHits, gModeState, gCurrentEntryName, gStatusField, gFTsearchscope, gGlobalStepCount, gLocalStepCount
-
- on hBuildFTfromEntries
- hReportStatus("Building lookup map ")
- set LmyitemK to 1
- set Lmax to mGetThisItemsMax(oIndexMediator, LmyitemK)
- set Lnewlist to [:]
- sort(Lnewlist)
- repeat with i = 1 to Lmax
- put " " after field gStatusField
- set Lthisname to mGetThisEntryName(oIndexMediator, gModeState, LmyitemK, i)
- set Lthischar to char 1 of string(Lthisname)
- set LthisItem to hConvertAlphaToItem(hCapitalize(Lthischar))
- if LthisItem > 26 then
- delete char 1 of Lthisname
- delete char length(Lthisname) of Lthisname
- set Lthischar to char 1 of string(Lthisname)
- set LthisItem to hConvertAlphaToItem(hCapitalize(Lthischar))
- end if
- set LthisAttriblist to [0]
- addProp(Lnewlist, Lthisname, LthisAttriblist)
- end repeat
- set gNumofHits to Lmax
- setAt(mGetEntireMode(oIndexMediator, gModeState), LmyitemK, Lnewlist)
- mUpdateLimitsList(oIndexMediator, #FoundSet, gNumofHits)
- hReportStatus("Lookup complete...")
- end
-
- on hConvertAlphaToItem pTheAlpha
- set Litem to charToNum(string(pTheAlpha))
- if Litem >= 65 then
- set Litem to Litem - 64
- else
- set Litem to value(pTheAlpha)
- end if
- return Litem
- end
-
- on hConvertItemtoAlpha pItem, pMode
- if gModeState = #CHRO then
- return pItem
- else
- if gModeState = #EPISSUB then
- return string(pItem)
- else
- if gModeState = #FoundSet then
- if gFTsearchscope = #CHRO then
- return pItem
- else
- if gFTsearchscope = #ALL then
- if voidp(pMode) then
- set Lmode to hGetMode(gCurrentEntryName)
- else
- set Lmode to pMode
- end if
- if Lmode = #CHRO then
- return pItem
- end if
- set pItem to pItem + 64
- set Lalpha to numToChar(pItem)
- else
- set pItem to pItem + 64
- set Lalpha to numToChar(pItem)
- end if
- end if
- else
- set pItem to pItem + 64
- set Lalpha to numToChar(pItem)
- end if
- end if
- end if
- return Lalpha
- end
-
- on hConstructFieldName pWhatItem, pMode
- if pMode <> #CHRO then
- set pWhatItem to hConvertItemtoAlpha(pWhatItem, pMode)
- end if
- return "ATTRIB_" & pWhatItem & "_" & string(pMode)
- end
-
- on hExtractAlphaItem PThisStr
- set Lcurr to value(char 8 to 9 of PThisStr)
- if integerp(Lcurr) then
- return Lcurr
- else
- set Lcurr to char 8 of PThisStr
- if integerp(value(Lcurr)) then
- return value(Lcurr)
- else
- set Lcurr to charToNum(Lcurr)
- return Lcurr - 64
- end if
- end if
- end
-
- on hSetGlobalCounter pWhat
- set gGlobalStepCount to pWhat
- end
-
- on hSetLocalCounter pWhat
- set gLocalStepCount to pWhat
- end
-
- on hGetMyAlphaGroupItem pWGC
- if (gModeState = #ENCY) or (gModeState = #EPIS) or (gModeState = #CHRO) or (gModeState = #EPISSUB) then
- set vListStart to mGetMyFirstItem(oIndexMediator)
- set vListEnd to mGetMyMaxItems(oIndexMediator)
- set vFound to 0
- repeat while vFound = 0
- if vListEnd <= (vListStart + 1) then
- set vFound to 1
- end if
- set vCheckPoint to vListStart + ((vListEnd - vListStart) / 2)
- if pWGC > mGetThisItemsMax(oIndexMediator, vCheckPoint) then
- set vListStart to vCheckPoint
- next repeat
- end if
- set vListEnd to vCheckPoint
- end repeat
- if pWGC > vListEnd then
- set pWGC to vListEnd
- end if
- return vListEnd
- else
- return 1
- end if
- end
-
- on hUpdateCurrItem pToThis
- if (gModeState = #CHRO) and (length(pToThis) <> 2) then
- beep()
- end if
- if (gModeState <> #CHRO) and (length(pToThis) <> 1) then
- beep()
- mSetCurrItem(oIndexMediator, pToThis)
- end if
- if not (gModeState = #EPISSUB) then
- if gModeState <> #CHRO then
- mSetCurrItem(oIndexMediator, hConvertAlphaToItem(hCapitalize(pToThis)))
- else
- mSetCurrItem(oIndexMediator, pToThis)
- end if
- else
- end if
- end
-
- on hSetIncomingCurrItem pThePgPtr
- mSetCurrItem(oIndexMediator, hGetMyAlphaGroupItem(pThePgPtr))
- end
-